<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>

<tiles:insertDefinition name="defaultTemplate">
    <tiles:putAttribute name="body">
        <h1>Agregar Lanas a ${amigurumi.nombre}</h1>
        
        <form action="/crochet/amigurumi/asignarLanas" method="POST">
            <c:forEach items="${lanas}" var="lana" varStatus="status">
                <p>
                    ${lana.marca}|${lana.color}
                    <input name="lana${status.index}" type="checkbox" value="${lana.id}"/> 
                </p>
            </c:forEach>
            <input name="amigurumi" type="hidden" value="${amigurumi.id}" />
            <input name="tam" type="hidden" value="${fn:length(lanas)}" />
            <input type="submit" value="Asignar Lanas" /></form>
        </form>
    </tiles:putAttribute>
</tiles:insertDefinition>